package com.example.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.entity.SysCross;

import com.example.mapper.CrossMapper;
import com.example.service.CrossService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CrossServiceImpl implements CrossService {

    @Autowired
    CrossMapper crossMapper;

    @Override
    public SysCross selectByCrossNumber(String crossNumber) {
        List<SysCross> sysCrossLists = crossMapper.selectList(new QueryWrapper<SysCross>().select().eq("cross_number", crossNumber));
        return sysCrossLists.get(0);
    }

    @Override
    public void add(SysCross sysCross) {
        sysCross.setStatus(1);
        crossMapper.insert(sysCross);
    }

    @Override
    public List<SysCross> getSysCross(Integer uid) {
        return crossMapper.selectList(new QueryWrapper<SysCross>().select().eq("uid", uid));
    }
}
